import request from "@/utils/request";

export function searchArchis(params) {
    console.log("信息查询参数 =>")
    console.log(params)
    return request({
        url: '/api/info/searchArchis',
        method: 'get',
        params: {
            name: params.name,
            city: params.city,
            largeCate: params.categories.large,
            midCate: params.categories.mid,
            minCate: params.categories.min
        }
    })
}

export function fetchList(params) {
    return request({
        url: '/api/info/searchArchis',
        method: 'get',
        params: {
            name: params.name,
            city: params.city,
            largeCate: params.categories.large,
            midCate: params.categories.mid,
            minCate: params.categories.min,
            pageSize: params.pageSize,
            pageNum: params.pageNum
        }
    })
}

export function deleteArchi(id) {
    return request({
        url: '/api/info/deleteArchi/' + id,
        method: 'delete'
    })
}

export function getArchi(id) {
    return request({
        url: '/api/info/getArchi/' + id,
        method: 'get'
    })
}

export function updateArchi(data, id) {
    let data1 = Object.assign({}, data)
    data1.largeCate = data.categories.large
    data1.midCate = data.categories.mid
    data1.minCate = data.categories.min
    console.log(data1)
    return request({
        url: '/api/info/updateArchi/' + id,
        method: 'put',
        data: data1
    })
}

export function addArchi(data) {
    let data1 = Object.assign({}, data)
    data1.largeCate = data.categories.large
    data1.midCate = data.categories.mid
    data1.minCate = data.categories.min
    console.log(data1)
    return request({
        url: '/api/info/addArchi',
        method: 'post',
        data: data1
    })
}
